System for representing line drawings by polygonal lines

ABSTRACT

A system for representing line drawings by polygonal lines. In the system, a binary digital image is scanned in a main scanning direction to form picture element connection data with a first image picture element as a start point picture element which is scanned next to a first background picture element and with a second background picture element as an end point picture element which is scanned next to a second image picture element, and the relationships between the picture element connection data are detected to provide as picture element block data a group of picture element connection data which have predetermined relationships. Further, it is determined from each picture element block data whether or not the picture element block thereof represents a straight segment, and straight line approximation data is provided according to both the uppermost picture element connection data and the lowermost picture element connection data in the picture element block when it is determined that the picture element block represents a straight segment, whereby parts of the drawing to be represented by polygonal lines are detected and processed with high efficiency.

This application is a continuation of application Ser. No. 07/739,232filed Aug. 1, 1991 now abandoned.

BACKGROUND OF THE INVENTION

This invention relates to a system for representing line drawings bypolygonal lines in which a line drawing is read as binary digital data,and the binary digital data are converted into polygonal line data.

A method of representing a line drawing by polygonal lines is oftenemployed for data compression or data reuse, as is well known in theart. More specifically, the following three methods have been employedfor representing line drawings by polygonal lines:

(1) A first method in which a line drawing is represented by a number ofthin lines, and the resultant picture elements are traced (cf. JapanesePatent Application Unexamined Publication Nos. Hei. 1-134682 and Hei.1-142880).

(2) A second method in which the contour lines of an image areextracted, and the center lines of the contour lines thus extracted areobtained.

(3) A third method in which an image is divided into a number of squaresarranged in a matrix form, and the local pattern of each square isidentified (cf. Japanese Patent Application Unexamined Publication No.Sho. 62-191988).

However, these methods are disadvantageous in that, since it isnecessary for each of the methods to employ an image processingtechnique which accesses an image in its entirety, the image processingtime is necessarily long, and it is essential to provide a largecapacity memory because the image must be kept in memory during theimage processing time.

On the other hand, a method has been employed in which polygonal linesare obtained from run data (cf. Japanese Patent Application UnexaminedPublication No. Sho. 63-45687). In the method, straight segmentsdifferent in inclination are detected from the variation between thegravity center values of the m-th run and the (m-n)-th run. However, themethod depends only on the local data called "run" in the image, andtherefore it cannot determine whether or not the run can be representedby polygonal lines. For instance, in the case of a solid arrow mark in adrawing, the method cannot detect its configuration from the run data.

SUMMARY OF THE INVENTION

Accordingly, an object of this invention is to eliminate theabove-described difficulties accompanying a conventional method ofrepresenting line drawings by polygonal lines.

More specifically, an object of the invention is to provide a system forrepresenting line drawings by polygonal lines in which parts to berepresented by polygonal lines are detected with high efficiency andonly the parts thus detected are processed so as to be represented bypolygonal lines; that is, an image processing operation is not requiredto make access to the whole image.

The foregoing object and other objects of the invention have beenachieved by the provision of a system of representing line drawings bypolygonal lines according to the invention which comprises: a pictureelement connection data forming section for scanning a binary digitalimage in a main scanning direction, to form picture element connectiondata with a first image picture element as a start point picture elementwhich is scanned next to a first background picture element and with asecond background picture element as an end point picture element whichis scanned next to a second image picture element; a picture elementblock data forming section for detecting relationships between thepicture element connection data, to provide as picture element blockdata a group of picture element connection data which have predeterminedrelationships; a straight segment determining section for determiningfrom each picture element block data whether or not the picture elementblock thereof represents a straight segment; and a straight lineapproximating section for providing straight line approximation dataaccording to both the uppermost picture element connection data and thelowermost picture element connection data in the picture element block,when the straight segment determining section determines that thepicture element block represents a straight segment.

With the system of the invention, an image is converted into a stackeddata structure, and the stacked data structure is utilized to representthe image by polygonal lines. More specifically, picture elementconnection data, and picture element block data which is a group ofpicture element connection data are obtained from an image, and thosedata are utilized to represent the image by polygonal lines.

BRIEF DESCRIPTION OF THE DRAWINGS

In the accompanying drawings:

FIG. 1 is a block diagram showing the arrangement of a system ofrepresenting line drawings by polygonal lines according to an embodimentof the invention;

FIG. 2 is a flow chart for a description of the operation of a pictureelement connection data forming section in the system shown in FIG. 1;

FIG. 3 is also a flow chart for a description of the operation of apicture element block data forming section in the system shown in FIG.1;

FIG. 4 is an explanatory diagram for a description of picture elementconnection data in the system;

FIG. 5 is an explanatory diagram for a description of picture elementblock data in the system; and

FIG. 6 is an explanatory diagram for a description of the direction ofextension of picture element block data.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

One preferred embodiment of this invention will be described withreference to the accompanying drawings.

A system of representing line drawings by polygonal lines in theembodiment shown in FIG. 1, comprises an image inputting section 1 suchas an image scanner for inputting the binary data of an image, an imagedata storing section 2 for storing image data inputted by the imageinputting section 1, a picture element connection data forming section 3which scans the binary digital image in the main scanning directionwhich is stored in the image data storing section 2, and forms pictureelement connection data with a first image picture element (or a blackpicture element) as a start point picture element which is scanned nextto a first background picture element (or a white picture element) andwith a second background picture element as an end point picture elementwhich is scanned to a second image picture element. The system alsoincludes a picture element connection data storing section 4 for storingthe picture element connection data formed by the picture elementconnection data forming section 3, a picture element block data formingsection 5 which detects picture element connection data adjacent in avertical direction (or in the auxiliary scanning direction) and providesas picture element block data a group of picture element connection datawhich have a predetermined relationship, a picture element block datastoring section 6 for storing the picture element block data formed bythe picture element block data forming section 5, a straight segmentdetermining section 7 for determining from the picture element blockdata whether or not the picture element block thereof represents astraight segment, a straight line approximating section 8 which, whenthe straight segment determining section 7 determines that a pictureelement block represents a straight segment, provides straight lineapproximation data according to both the data of the start and endpoints of the uppermost picture element connection data and the data ofthe start and end points of the lowermost picture element connectiondata of the picture element block, and a polygonal line data storingsection 9 for storing as polygonal line data the data provided by thestraight line approximating section 8.

A process of representing a line drawing by polygonal lines (hereinafterreferred to as "a polygonal line process", when applicable) will bedescribed with reference to FIG. 1.

The binary digital image data inputted by the image inputting section 1are stored in the image data storing section 2. The picture elementconnection data forming section 3 forms the run data of the image; i.e.,the picture element connection data from the contents of the image datastoring section 2. The picture element block data forming section 5extracts the picture element block data representing the picture elementconnection data which are connected to one another vertically in theimage.

A picture element connection data extracting procedure will be describedwith reference to FIG. 2. FIG. 4 shows picture element connection data.

An image is scanned in the raster direction (or in the main scanningdirection), to detect a picture element Is (i,j) where the backgroundpicture element value of the image changes to the drawing pictureelement value (Steps 201 through 204 in FIG. 2). More specifically, animage width m, image height n, and black picture element value px areset (Step 201), and a start point is set to (i=0, j=0) for the rasterscan (Step 202). It is determined whether or not the picture element Is(i,j) at the scanning position is the black picture element value px(Step 203). When it is the black picture element, then the pictureelement Is (i,j) is registered as the start point of the picture elementconnection data (Step 204).

The scanning operation is continued until a picture element Ie (i,j)≠pxis detected where the drawing picture element value changes to thebackground picture element value (Steps 205 through 207). Morespecifically, it is determined from i<m whether or not the end of onescanning line is reached by the scanning operation (Step 205). When theend of the scanning line is not reached yet, it is determined whether ornot the drawing picture element value has changed to the backgroundpicture element value (Step 206). When it is determined that the drawingpicture element value has not changed yet, the scanning operation isadvanced by one picture element (Step 207), and the above-describedoperations are carried out again. In Step 206, if it is determined thatthe value of the picture element has changed (Ie (i,j)≠px), then thepicture element Ie (i,j) is registered as the end point of the pictureelement connection data (Step 208). When, in this case, the pictureelement is not detected where the drawing picture element value changesto the background picture element value until the image is scanned tothe right end, it is judged that the connection of picture elements isended on this scanning line, and the picture element where the drawingpicture element value changes to the background picture element value isdetermined as a picture element Ie (m,j).

After Step 208 is executed, Steps 209 and 210 are executed to completethe scanning operation on the scanning line.

The picture elements are registered as follows: That is, the pictureelement Is is stored as the start point S(t) of the t-th picture elementconnection data in the picture element connection data storing section4, and the picture element Ie is stored as the end point E(t) of thet-th picture element connection data in the section 4. In thisoperation, the length L(t) of the picture element connection data may bestored as additional data. The abovedescribed operations are carried outuntil the scanning line goes over the height n of the image (Steps 211through 213).

Next, the picture element connection data thus extracted and the imageare utilized to extract picture element block data. This will bedescribed with reference to FIG. 3, a flow chart.

First, the total number of picture element connection data is set to m(Step 301), and the picture element connection data number n is set to 0(n=0), and the picture element block data number i is also set to 0(i=0) (Step 302).

The n-th picture element connection data DATA(N) is read out of thepicture element connection data storing section 4, and it is determinedwhether or not the data thus read out has been registered as part of thepicture element block (Step 303). When it is determined that the datahas been stored as part of the picture element block, the value n isincreased by one (1) (n=n+1) in order to read the next picture elementconnection data (Step 304). Thereafter, it is determined whether or notn is smaller than m, so as to determine whether or not the pictureelement block formation has been accomplished for all the pictureelement connection data (Step 305).

When, in Step 303, it is determined that the data has not beenregistered as part of the block, formation of new picture element blockdata is carried out (Steps 306 through 314).

The formation of new picture element block data will be described indetail.

In the case where the picture element connection data DATA(n) has notbeen registered as part of the picture element block, it is registeredin picture element block data BLOCK(i) (Step 306)., The value of thevariable n is temporarily saved for later use (Step 307).

Thereafter, it is determined whether or not the picture elementconnection data DATA(N) satisfies the following three conditions (Step308):

Condition (1)--Only one picture element connection data is connectedbelow the data DATA(n).

Condition (2)--The length of the picture element connection dataconnected below the data DATA(N) is not abruptly changed. For instance,the length is not increased twice as large, nor reduced to half.

Condition (3)--When the picture element connection data connected belowthe data DATA(n) is registered in the block, the direction of extensionof the block is not changed.

The term "direction of extension" as described in condition (3) isintended to mean the direction of variation (increase or decrease) inposition between the i-th picture element connection data DATA_(u) (i)from the top in a block and the (i+1)-th picture element connection dataDATA_(u) (i+1). More specifically, condition (3) means that the sign ofthe difference [a_(i) =DATA_(u) (i+1)-DATA_(u) (i)] between thex-coordinate of the middle point of picture element connection dataDATA_(u) (i) and the x-coordinate of picture element connection dataDATA_(u) (i+1) in a block is coincident with the sign of the difference[a_(i+1) =DATA_(u) (i+2)-DATA_(u) (i+1)] between the x-coordinate of themiddle point of picture element connection data DATA_(u) (i) and thex-coordinate of picture element connection data DATA_(u) (i+1) which isobtained when new picture element connection data DATA_(u) (i+2) isadded to the block.

When the picture element connection data DATA(n) satisfies none of theconditions (1), (2) and (3), it is determined that the picture elementblock data BLOCK(n) has been ended.

When the picture element connection data DATA(n) satisfies theconditions (1), (2) and (3), the picture element connection data storingsection 4 is searched for picture element connection data DATA(j) whichis connected to the data DATA(n) (Step 309).

Next, it is determined whether or not the picture element connectiondata DATA(j) satisfies the following condition (4):

Condition 4--Only the picture element connection data DATA(n) isconnected above the picture element connection data DATA(j).

When the picture element connection data DATA(j) satisfies the condition(4), it is additionally registered in the picture block data BLOCK(i)(Step 311). Then, in order to search for picture element connection datato be connected to the picture element connection data DATA(j) thusregistered, the variable n is set to j (Step 312), and Step 308 iseffected again.

The above-described operations are carried out successively until thepicture block data BLOCK(i) is ended. When in Step 308 the conditions(1) through (3) are not satisfied, or in Step 310 the condition (4) isnot satisfied, it is determined that the picture element block dataBLOCK(i) has been ended, and Step 304 is effected. In this case, thevariable n is set to the value saved in Step 307 (Step 313) and thevariable i is increased by one (Step 314).

Thereafter, the picture element connection data storing section 4 issearched for picture element connection data which is not registered aspicture element block data. Further, the above-described operations areperformed successively until all the picture element connection datahave been registered as picture element block data.

It has been described that the picture element block data actuallyincludes all the picture element connection data. However, in practice,the picture element block data is represented typically by thecircumscribed rectangle of the region which the block occupies in theimage, and the picture element connection data contained in the blockrecord only the positions in the picture element connection data storingsection 4.

One example of an image which is represented by picture element blockdata is as shown in FIG. 5.

Referring back to FIG. 1, the straight segment determining section 7operates to determine whether or not each block represents a straightsegment in an image. This operation is to prevent the application of thepolygonal line process to solid parts of a drawing such as solid arrowmarks or round marks, because the polygonal line process should beapplied to parts of a drawing which are represented by straight lines.

The straight segment determining section 7 reads the lengths of all thepicture element connection data in each block, so that,, when a blockincludes a number of picture element connection data equal in length,the block is determined as a straight segment. Furthermore, the section7 detects the dimensions of the circumscribed rectangle of the block, sothat, when the value which is obtained by dividing its width by itsheight is larger than a predetermined value, the block is determined asa horizontal line. This data is outputted additionally.

The straight line approximating section 8 operates to read out of thepicture element block data storing section 6 the picture element blockdata which has been determined as a straight segment by the straightsegment determining section 7. In the case where the block has beendetermined as a vertical line by the straight segment determiningsection 7, the straight line approximating section 8 obtains as straightline approximation data the middle points of the uppermost pictureelement connection data and the lowermost picture element data in thepicture element block. In the case where, on the other hand, the blockhas been determined as a horizontal line by the straight segmentdetermining section 7, the straight line approximating section 8 obtainsas straight line approximation data the right and left end points in theblock. The straight line approximation data obtained from the blocks arestored, as polygonal line data representing the binary digital image, inthe polygonal line data storing section 9.

Thus, the polygonal line process has been accomplished.

In the above-described embodiment, the direction of extension of pictureelement block data is the direction in which the x-coordinates of themiddle points of the picture element connection data change. However,the same picture element block data can be obtained by the followingmethod: First, picture element block data are formed irrespective of thecondition (3), and then each block is divided into subblocks. In each ofthe sub-blocks, a segment is formed which connects the middle point ofthe uppermost picture element data to the middle point of the lowermostpicture element data in the sub-block. The direction of the segment thusformed is detected, and the block is divided at the point where thedirection of the segment changes more than a predetermined thresholdvalue.

As was described above, in the system of the invention, an image isconverted into a stacked data structure, and the polygonal line processis carried out by utilizing the stacked data structure. Therefore, inthe polygonal line process, it is unnecessary to perform the imageprocessing operation which takes time, and accordingly the polygonalline data can be obtained quickly.

Furthermore, in the system of the invention, the picture elementconnection data representing the run data of an image are utilized toobtain the picture element block data in which the picture elementconnection data are connected vertically. Therefore, each of the blockdata represent a segment, so that polygonal data can be obtained withhigh accuracy.

The picture element block data includes the picture element connectiondata. Hence, the arrangement of data in each block can be detected bymeasuring the lengths of the picture element connection data, andtherefore polygonal data can be provided only for part of the drawing.

While there has been described in connection with the preferredembodiment of the invention, it will be obvious to those skilled in theart that various changes and modifications may be made therein withoutdeparting from the invention, and it is aimed, therefore, to cover inthe appended claim all such changes and modifications as fall within thetrue spirit and scope of the invention.

What is claimed is:
 1. A system for representing line drawings bypolygonal lines comprising:picture element connection data forming meansfor scanning a binary digital image in a main scanning direction to formsets of picture element connection data, each set having a start pointpicture element where a background picture element value of the imagechanges to a drawing picture element value and having an end pointpicture element where the drawing picture element value changes to thebackground picture element value, said start point picture element andsaid end point picture element of each set of picture element connectiondata lying in one scanning line in the main scanning direction; pictureelement block data forming means for detecting relationships betweensets of picture element connection data which are adjacent in adirection perpendicular to said main scanning direction and for formingpicture element block data from sets of picture element connection datahaving predetermined relationships; straight segment determining meansfor determining from each picture element block data whether or not thepicture element block thereof represents a straight segment; andstraight line approximating means for providing straight lineapproximation data according to both the uppermost element connectiondata and the lowermost picture element connection data in said pictureelement block in response to a determination by said straight segmentdetermining means that said picture element block represents a straightsegment.
 2. A system according to claim 1, wherein said straight segmentdetermining means determines whether said picture element blockrepresents a vertical or horizontal line.
 3. A system according to claim2, wherein said straight line approximating means obtains as thestraight line approximation data the middle points of the uppermostpicture element connection data and the lowermost picture elementconnection data in response to a determination by said straight segmentdetermining means that said picture element block represents a verticalline.
 4. A system according to claim 2, wherein said straight lineapproximating means obtains as the straight line approximation data theright and left end points in said picture element block in response to adetermination by said straight segment determining means that saidpicture element block represents a horizontal line.
 5. A systemaccording to claim 1, further comprising image data storing means forstoring said binary digital image to be scanned by said picture elementconnection data forming means.
 6. A system according to claim 1, furthercomprising picture element connection data storing means for storing thepicture element connection data formed by said picture elementconnection data forming means, and picture element block data storingmeans for storing the picture element block data formed by said pictureelement block data forming means.
 7. A method for representing linedrawings by polygonal lines comprising:scanning a binary digital imagein a main scanning direction to form sets of picture element connectiondata by detecting a start point picture element where the backgroundpicture element value of the image changes to the drawing pictureelement value and by detecting an end point picture element where thedrawing picture element value changes to the background picture elementvalue, said start point picture element and said end point pictureelement of each set of picture element connection data lying in onescanning line in the main scanning direction; forming picture elementblock data by detecting relationships between sets of picture elementconnection data which are adjacent in a direction perpendicular to saidmain scanning direction and by forming picture element blocks from saidsets of picture element connection data having predeterminedrelationships; determining from each picture element block data whetheror not the picture element block represents a straight segment; andproviding straight line approximation data according to both theuppermost picture element connection data and the lowermost pictureelement connection data in said picture element block in response to adetermination in said determining step that said picture element blockrepresents a straight segment.
 8. A method according to claim 7, whereinsaid determining step includes determining whether said picture elementblock represents a vertical or horizontal line.
 9. A method according toclaim 8, wherein said providing step obtains middle points of anuppermost picture element connection data and a lowermost pictureelement connection data as the straight line approximation data inresponse to a determination in said determining step that said pictureelement block represents a vertical line.
 10. A method according toclaim 8, wherein said providing step obtains a right end point and aleft end point as the straight line approximation data in response to adetermination in said determining step that said picture element blockrepresents a horizontal line.
 11. A method according to claim 7, furthercomprising storing said binary digital image to be scanned in saidscanning step.
 12. A method according to claim 7, further comprisingstoring said picture element connection data formed in said scanningstep and storing said picture element block data formed in said formingstep.